<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
    <style>
        #app{
            width: 100px;
            height: 100px;
            background-color: rgb(113, 201, 201);
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
</head>
<body>
    <!-- 
        v-for指令的作用是根据数据生成列表结构
        数组经常和v-for结合使用
        语法是(item,index) in 数据
        item和index可以结合其他指令一起使用
        数组长度的更新会同步到页面上，是响应式的
     -->
    <div id="app" >
        <ul>
            <li v-for=" item in Array">{{item}}</li>
        </ul>
        <button ></button>
        <!-- <ul>
            <li v-for="item in Array">你好,{{ item }}</li>
        </ul>
        <h2 v-for="item in vegetables" :title="item.name">{{ item.name }}</h2>
        <button @click="add">点我添加</button>
        <button @click="remove">点我移除</button> -->
    </div>

    <script>
        // var app=new Vue({
        //     el:"#app",
        //     data:{
        //         Array:["张三","李四","王五","马六","二蛋"],
        //         vegetables:[
        //             {name:"葱花炒蛋"},
        //             {name:"番茄炒蛋"}
        //         ]
        //     },
        //     methods:{
        //         remove:function(){
        //            this.Array.
        //         }
        //     }
        
            
        // })
        var app = new Vue({
            el:'#app',
            data:{
                Array:["张三","李四","王五","马六","二蛋"],
                vegetables:[
                    {name:"葱花炒蛋"},
                    {name:"番茄炒蛋"}
                ]
            },
            methods:{
                add:function(){
                    this.vegetables.push({ name:"韭菜炒蛋"});
                },
                remove:function(){
                    // 移除最左边的一个
                   this.vegetables.s
                }
            }
        }) 
    </script>
</body>
</html>
